<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%String contextRoot = request.getContextPath();%>
<f:loadBundle basename="properties.messages" var="msg"/>
<f:view>
<!doctype html>
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<title>SISDEP : Sistema de Informaci<h:outputText value="#{msg.tilde_o}" />n de Espacio P<h:outputText value="#{msg.tilde_u}" />blico</title>
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="stylesheet" href="<%=contextRoot%>/css/validationEngine.jquery.css" type="text/css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/template.css" type="text/css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/normalize.css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/uniform.css"> <!-- estilos formularios -->
	<link rel="stylesheet" href="<%=contextRoot%>/css/cuerpo.css">	
	<link rel="stylesheet" href="<%=contextRoot%>/css/richCustom.css">
</head>
<body>
<div id="marco"> <!--inicio contenedor --> 
<div class="arriba-cuerpo"></div> <!-- Para ver borde redondo en IE -->
<div class="cuerpo">
<a href="<%=contextRoot%>/index.jsf"><img src="<%= contextRoot %>/images/logos.png" /></a>
<div class="clear"></div>
<!-- Menu y Usuario init() -->
	<%@ include file="include/menuUsuario.jsp" %>
<!-- Menu y Usuario end() -->
<div class="clear"></div>
<!-- Formulario --> 
<div id="buscador">
<h2>Regulaci<h:outputText value="#{msg.tilde_o}" />n – Entrega Carn<h:outputText value="#{msg.tilde_e}" /></h2>

<h:form id="carneDeliverySearchForm">

<span class="left">
<label>N<h:outputText value="#{msg.tilde_u}" />mero de contrato</label>
	<h:inputText id="numero" size="10" maxlength="20" 
				value="#{carneController.carneSearch.numero}" />
	
	<rich:spacer width="33%" />
</span>

<span class="left">
<label>Documento de Identidad - Comerciante</label>
 	<h:inputText id="idPersona" size="10" maxlength="20" 
				value="#{carneController.carneSearch.idPersona}" />
</span>

<div class="clear"></div>

<span class="botones right">
	<h:commandButton id="carneSearchButton"
				 type="submit" 
                 value="Buscar" 
                 ondblclick="return false;" 
                 styleClass="buscador form button"
                 action="#{carneController.getDeliveryCarneByParameters}" >
	</h:commandButton>
</span>
</h:form>
</div>
<!-- Fin formulario -->
 
<div id="buscador">
	<span class="left"><h2>Resultados de la Consulta de Carn<h:outputText value="#{msg.tilde_e}" />:</h2></span>
</div>

<h:form id="carneResultsForm">

<div style="overflow-x: scroll; position: relative; width: 670px;">

 <rich:dataTable id="carneData" headerClass="standardTable_Header" width="100%"
             border="0" cellpadding="3" cellspacing="1" 
             footerClass="standardTable_Header" rowKeyVar="rowIndex"
             rowClasses="odd,this.style.backgroundColor='#FFFFFF'"
             onRowMouseOver="this.style.backgroundColor='#C0C0C0'"
   			 onRowMouseOut="this.style.backgroundColor='#FFFFFF'"
             var="carneRow" value="#{carneController.carneListModel}"
           	 rows="10" >
      <h:column>
          <f:facet name="header">
             <h:outputText value="ASIGNAR" />
          </f:facet>
              <a4j:commandLink id="editType" styleClass="formTextLink"
                             title="Asignar el carne actual..."	 onclick="if(!window.confirm('¿Confirma la asignaci#{msg.tilde_o}n del Carn#{msg.tilde_e}: #{carneRow.codigo}?')) {return false;}"		                                   
                             action="#{carneController.deliveryCarneButton}" reRender="carneData">
                  <f:param name="idCarneSlct" value="#{carneRow.id}" />
                  <h:graphicImage value="/images/edit_ese.gif" style="border: 0px solid #FFFFFF;" />
              </a4j:commandLink>
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Codigo carne" /></f:facet>
          <h:outputText value="#{carneRow.codigo}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Tipo" /></f:facet>
          <h:outputText value="#{carneRow.tipo}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Documento" /></f:facet>
          <h:outputText value="#{carneRow.docPersona}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Asociacion" /></f:facet>
          <h:outputText value="#{carneRow.asociacion}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Contrato" /></f:facet>
          <h:outputText value="#{carneRow.numero}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Barrio" /></f:facet>
          <h:outputText value="#{carneRow.barrio}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Comuna" /></f:facet>
          <h:outputText value="#{carneRow.comuna}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Tipologia" /></f:facet>
          <h:outputText value="#{carneRow.tipologia}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Tipo Venta" /></f:facet>
          <h:outputText value="#{carneRow.tipoVenta}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Tipo Amoblamiento" /></f:facet>
          <h:outputText value="#{carneRow.tipoAmoblamiento}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Estado" /></f:facet>
          <h:outputText value="#{carneRow.estado}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Copia" /></f:facet>
          <h:outputText value="#{carneRow.copia}" />
      </h:column>
      <h:column>
          <f:facet name="header" ><h:outputText value="Fecha Expedicion" /></f:facet>
          <h:outputText value="#{carneRow.fechaExpedicionFormated}" />
      </h:column>
   </rich:dataTable>

	<h:panelGrid columns="1" styleClass="tablapaginacion" columnClasses="standardTable_ColumnCentered" >
		<rich:datascroller id="carneScroll" for="carneData" fastStep="10"
			pageIndexVar="pageIndex" styleClass="scroller" maxPages="8">
			<f:facet name="first_disabled">
			</f:facet>
			<f:facet name="last_disabled">
			</f:facet>
			<f:facet name="previous">
					<h:graphicImage url="/images/arrow-previous.gif" />
			</f:facet>
			<f:facet name="next">
					<h:graphicImage url="/images/arrow-next.gif" />
			</f:facet>
			<f:facet name="fastforward_disabled">
			</f:facet>
			<f:facet name="fastrewind_disabled">
			</f:facet>
		</rich:datascroller>
	</h:panelGrid>

</div>
</h:form>
<!-- Fin tabla -->
</div>
<div class="abajo-cuerpo"></div> <!-- Para ver borde redondo en IE -->
</div> <!-- Fin contenedor -->
<div class="footer"></div>
	
	<script src="<%=contextRoot%>/js/jquery/lib/jquery-1.7.2.min.js"></script><!-- De ser 1ro -->
	<script src="<%=contextRoot%>/js/script.js" type="text/javascript"></script><!-- De ser 2do -->
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.uniform.min.js"></script> <!-- formularios --> 
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
	
	<script src="<%=contextRoot%>/js/sisdep.js"	type="text/javascript"></script>
	
	<script type="text/javascript">
	jQ(document).ready(function() {
		jQ("input, select, input:checkbox, input:radio, input:file").uniform();
		jQ("#carneDeliverySearchForm").validationEngine('attach');
		jQ("#carneDeliverySearchForm").bind("jqv.form.result", function(event, errorFound) {
	        if(!errorFound) displayLoadingImage();
	    });
	});
	</script>
	
	<%@ include file="include/validationStatus.jsp" %>
	<%@ include file="include/modalMessageWindow.jsp" %>
</body>
</html>
</f:view>
